//package com.cskaoyan.servlet;
//
//import com.cskaoyan.bean.common.BaseRespVo;
//import com.cskaoyan.bean.vo.GoodsVo;
//import com.cskaoyan.service.GoodsService;
//import com.cskaoyan.service.GoodsServiceImpl;
//import com.fasterxml.jackson.core.JsonProcessingException;
//import com.fasterxml.jackson.databind.ObjectMapper;
//
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
//@WebServlet("/admin/goods/*")
//public class AdminGoodsServlet extends WdBaseServlet {
//    GoodsService goodsService = new GoodsServiceImpl();
//
//    private BaseRespVo create(HttpServletRequest request, HttpServletResponse response) {
//        // 1. 请求参数的接收
//        String resJstr = null;
//        try {
//            resJstr = request.getReader().readLine();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        ObjectMapper objectMapper = new ObjectMapper();
//        GoodsVo goodsVo = null;
//        try {
//            goodsVo = objectMapper.readValue(resJstr, GoodsVo.class);
//        } catch (JsonProcessingException e) {
//            return BaseRespVo.fail(402,"参数值不对");
//        }
//
//        // 2. Service封装对象
//        BaseRespVo baseRespVo = goodsService.create(goodsVo);
//
//        // 3. 将对象转为Json字符串，通过response进行响应
//
//        return baseRespVo;
//    }
//}
